package com.xmg.design23.d12_observer;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: mazhongqing
 * @Date: 2021/3/25 12:08
 */
public abstract class Subject {
    protected List<Observer> observers = new ArrayList<>();

    public void add(Observer observer){
        observers.add(observer);
    }

    public void remove(Observer observer){
        observers.remove(observer);
    }

    public abstract void notifyObserver(); //通知观察者方法
}
